shout3d.core
Class TouchSensor

java.lang.Object
  |
  +--shout3d.core.Node
        |
        +--shout3d.core.Group
              |
              +--shout3d.core.TouchSensor
Direct Known Subclasses:
Anchor

public class TouchSensor
extends Group
implements DeviceObserver

TouchSensor Node Class. Rules for Activation: -- A TouchSensor that has no children will activate if the selected geometry is any descendent of the TouchSensor's parent node. -- A TouchSensor that has children will activate only if the selected geometry is a descendent of the TouchSensor itself. -- If more than one TouchSensor fit the above criteria, then the TouchSensor that is lowest in the hierarchy will activate. -- If more than one TouchSensor that are siblings fit the above criteria, then the TouchSensor that was created first will activate. (When reading a scene from file, TouchSensors are created in the order in which they are listed in the file.)


Field Summary
 BooleanField enabled
           
 FloatArrayField hitNormal
           
 FloatArrayField hitPoint
           
 BooleanField isActive
           
 BooleanField isOver
           
 DoubleField touchTime
           
 
Fields inherited from class shout3d.core.Group
children, defaultChildArray, hidden
 
Constructor Summary
TouchSensor()
          Constructs a default TouchSensor
TouchSensor(Shout3DViewer theViewer)
          Constructor that takes a viewer as input.
 
Method Summary
 boolean onDeviceInput(DeviceInput di, java.lang.Object userData)
          Called by the DeviceListener every time a device input comes in.
 void setViewer(Shout3DViewer theViewer)
          Override setViewer to get a picker from it and start observing devices
 
Methods inherited from class shout3d.core.Group
addChildren, getCameraBBoxMax, getCameraBBoxMin, getInverseMatrix, getLocalBBoxMax, getLocalBBoxMin, getMatrix, getWorldBBoxMax, getWorldBBoxMin, removeChildren
 
Methods inherited from class shout3d.core.Node
cleanUp, getDEFName, getField, getFieldByIndex, getFieldName, getNumFields, getTypeName, getViewer, isOfType, setDEFName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public final BooleanField enabled

hitPoint

public final FloatArrayField hitPoint

hitNormal

public final FloatArrayField hitNormal

isOver

public final BooleanField isOver

isActive

public final BooleanField isActive

touchTime

public final DoubleField touchTime
Constructor Detail

TouchSensor

public TouchSensor()
Constructs a default TouchSensor

TouchSensor

public TouchSensor(Shout3DViewer theViewer)
Constructor that takes a viewer as input.
Method Detail

setViewer

public void setViewer(Shout3DViewer theViewer)
Override setViewer to get a picker from it and start observing devices
Overrides:
setViewer in class Node

onDeviceInput

public boolean onDeviceInput(DeviceInput di,
                             java.lang.Object userData)
Called by the DeviceListener every time a device input comes in. Watches the cursor, changes it to a hand when mouse is over the TouchSensor. When the mouse is pressed over this TouchSensor, calls activate.
Specified by:
onDeviceInput in interface DeviceObserver
Parameters:
x - the x position of the mouse down event
y - the y position of the mouse down event